package com.guosheng.json;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class JsonTwo {

    public static void main(String[] args) {
        ArrayList json = new ArrayList();
        json.add("111");
        User user = new User();
        user.setJson(json);
        user.setCode("200");

        user.setMessage("true");
        String string = "(" + JSON.toJSONString(user) + ")";
        // String regex = "\"json\":(.*?),\"message\"";// 使用非贪婪模式！
        Pattern pattern = Pattern.compile("\\[\"(.*?)\"\\]");
        Matcher matcher = pattern.matcher(string);
        while (matcher.find()) {
            System.out.println(matcher.group(1));
        }
    }
}
